ON...GO TO
ON...GO SUB

Syntax: ON condition GO TO line1 *[,linei]*         
    or: ON condition GO SUB line1 *[,linei]*
Location: QL ROM

This is a structure which enables the program to jump to specific lines depending upon the value of a variable.

condition must be an integer expression which returns a value of one or more. 

After the command GO TO or GO SUB must appear a list of line numbers to jump to depending on the value of the condition. The value returned is then used to determine which of these line numbers will be jumped to, by counting the different options. If the result of the condition is zero, or more than the number of options, then the error 'Out of Range' will be returned.

If ON...GO SUB is used, then when a RETurn is executed from within the sub-routine, the program will continue from the statement following ON..GO SUB.

Example:
ON xa+start GO SUB 170,180,190

CROSS-REFERENCE:
These two commands can generally be replaced either by a calculated GO SUB or GO TO statement, or the SELect ON structure.
